home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / raytrace / rayshade / graphtal.lzh / Graphtal.Amiga / Color.h < prev    next >
C/C++ Source or Header  |  1992-11-17  |  1KB  |  60 lines

  1. /*
  2.  * Color.h  - class definition for color handling.
  3.  *
  4.  * Copyright (C) 1992, Christoph Streit (streit@iam.unibe.ch)
  5.  *                     University of Berne, Switzerland
  6.  * All rights reserved.
  7.  *
  8.  * This software may be freely copied, modified, and redistributed
  9.  * provided that this copyright notice is preserved on all copies.
  10.  *
  11.  * You may not distribute this software, in whole or in part, as part of
  12.  * any commercial product without the express consent of the authors.
  13.  *
  14.  * There is no warranty or other guarantee of fitness of this software
  15.  * for any purpose.  It is provided solely "as is".
  16.  *
  17.  */
  18.  
  19. #ifndef Color_H
  20. # define Color_H
  21.  
  22. #include "rcString.h"
  23.  
  24. /*___________________________________________________________ Color
  25.  *
  26.  * Colordefinitions are stored in a color file with the following
  27.  * format:
  28.  *
  29.  *  R G B  colorName
  30.  *   ...
  31.  *
  32.  * These color definitions are read only once.
  33.  */ 
  34.  
  35. class ColorTable;
  36.  
  37. class Color {
  38. public:
  39.   static void setupColors();
  40.  
  41.   Color();
  42.   Color(const rcString&);
  43.  
  44.   const rcString& colorName() const { return name; }
  45.   float r() const { return red; }
  46.   float g() const { return green; }
  47.   float b() const { return blue; }
  48.  
  49. private:
  50.   rcString name;
  51.   float red, green, blue;
  52.  
  53. private:
  54.   static void readColors();
  55.   static ColorTable* colors;
  56.   static rcString ColorFile;
  57. };
  58.  
  59. #endif // Color_H
  60.